import java.util.List;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;


public class Responses {
	
	static public class FollowersResponse {
		public List<Long> ids;			//id друзей
		public long next_cursor;		//курсор, -1 в начале и 0 в конце
		public String next_cursor_str;
		public long previous_cursor;
		public String previous_cursor_str;
		
	}
	
	static public class ErrorResponse {
		public String request;
		public String error;
	}

	static public class UserDataResponse {
		public boolean contributors_enabled;
		public String created_at;
		public boolean default_profile;
		public boolean default_profile_image;
		public String description;
		public int favourites_count;
		public Object follow_request_sent;
		public int followers_count;
		public Object following;
		public int friends_count;
		public boolean geo_enabled;
		public long id;
		public String id_str;
		public boolean is_translator;
		public String lang;
		public int listed_count;
		public String location;
		public String name;
		public Object notifications;
		public String profile_background_color;
		public String profile_background_image_url;
		public String profile_background_image_url_https;
		public boolean profile_background_tile;
		public String profile_image_url;
		public String profile_image_url_https;
		public String profile_link_color;
		public String profile_sidebar_border_color;
		public String profile_sidebar_fill_color;
		public String profile_text_color;
		public boolean profile_use_background_image;
		//public boolean protected
		public String screen_name;
		public int statuses_count;
		public Object time_zone;
		public Object url;
		public Object utc_offset;
		public boolean verified;
		
		public UserDataResponse() {
			
		}
				
	}
	
	//FollowersResponse или null
	static public FollowersResponse parseFollowersResponse(String response) {
		Gson gson = new Gson();
		FollowersResponse fResponse = null;
		try {
			fResponse = gson.fromJson(response, FollowersResponse.class);
		} catch (JsonSyntaxException e) {
			return null;
		}
		
		return fResponse;
	}
	
	//ErrorResponse или null
	static public ErrorResponse parseErrorResponse(String response) {
		Gson gson = new Gson();
		ErrorResponse eResponse = null;
		try {
			eResponse = gson.fromJson(response, ErrorResponse.class);
		} catch (JsonSyntaxException e) {
			return null;
		}
		
		return eResponse;
	}
	
	//UserDataResponse или null
	static public UserDataResponse parseUserDataResponse(String response) {
		Gson gson = new Gson();
		UserDataResponse uResponse = null;
		try {
			uResponse = gson.fromJson(response, UserDataResponse.class);
		} catch (JsonSyntaxException e) {
			//System.out.println("Responses.parseUserDataResponse() error:" + response);
			return null;
		}
		
		return uResponse;
	}

}


